Load register on condition immediate instruction

ABSTRACT

A data processor comprising a plurality of registers, and instruction execution circuitry having an associated instruction set, wherein the instruction set includes an instruction specifying at least a mask operand, a register operand and an immediate value operand, and the instruction execution circuitry, in response to an instance of the instruction, determines a Boolean value based on the mask operand and sets a respective one of a plurality of registers specified by the register operand of the instance to a value of the immediate value operand if the Boolean value is true. The instruction execution circuitry, in response to the instance of the instruction, may set the respective one of the plurality of registers specified by the register operand of the instance to zero if the Boolean value is false.

CROSS-REFERENCE TO RELATED APPLICATIONS/PRIOR FOREIGN APPLICATION

This application is a continuation of U.S. Ser. No. 15/008,684, entitled“LOAD REGISTER ON CONDITION IMMEDIATE OR IMMEDIATE INSTRUCTION,” filedJan. 28, 2016, which is a divisional of U.S. Ser. No. 13/793,223,entitled “LOAD REGISTER ON CONDITION WITH ZERO OR IMMEDIATEINSTRUCTION,” filed Mar. 11, 2013, which claims priority from Europeanpatent application number 12159177.0, filed Mar. 13, 2012, each of whichis hereby incorporated herein by reference in its entirety.

BACKGROUND

One or more aspects of the present disclosure relates to a dataprocessor, as well as to processing data in a data processor.

It is known to use data processors such as microprocessors for theprocessing of data, in particular data in binary representation. Inorder to meet given design objectives such as processing speed,processor cost, processor size and power consumption, typical dataprocessors have a limited instruction set having on the order of 100instructions or less and comprise processing hardware optimized toexecute those instructions in conformity with the design objectives.Such execution of instructions often involves a manipulation of datastored in one or more registers of the data processor.

SUMMARY

Shortcomings of the prior art are overcome and additional advantages areprovided through the provision of a computer system for facilitatingprocessing in a computing environment. The computer system includes amemory and a processor in communication with the memory and isconfigured to perform a method. The method includes executing aninstruction of an instruction set, the instruction having associatedtherewith a mask operand and an immediate value operand. The executingincludes determining whether a condition code is set to a valueindicated in the mask operand, and setting a location, specified usingthe instruction, to a value of the immediate value operand, based on thecondition code being set to the value indicated in the mask operand.

Computer-implemented methods and computer program products relating toone or more aspects are also described and claimed herein.

Additional features and advantages are realized through the techniquesdescribed herein. Other embodiments and aspects are described in detailherein and are considered a part of the claimed aspects.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically shows an embodiment of a data processor inaccordance with one or more aspects;

FIG. 2A depicts one example of an instruction set with exampleinstructions;

FIG. 2B depicts further details of an instruction of FIG. 2A; and

FIG. 2C depicts details of one example of the logic of the instructionof FIG. 2B.

DETAILED DESCRIPTION

One aspect teaches a data processor whose instruction set includes atleast one instruction belonging to a family of “load register oncondition immediate” instructions, i.e. instructions that, subject tofulfillment of a condition (at least partially) specified by therespective instruction, effect a loading of an immediate value (at leastpartially) specified by the respective instruction into a register (atleast partially) specified by the respective instruction when executedon the data processor.

Inter alia, one or more aspects teach a data processor that, in responseto an instance of an instruction specifying a mask operand, a registeroperand and an immediate value operand, determines a Boolean value basedon the mask operand and sets a respective one of a plurality ofregisters specified by the register operand of the instance to a valueof the immediate value operand if the Boolean value is true.

Moreover, one or more aspects teach a data processor that, in responseto an instance of an instruction specifying a mask operand, a registeroperand and an immediate value operand, determines a Boolean value basedon the mask operand and sets a respective one of a plurality ofregisters specified by the register operand of the instance to a valueof the immediate value operand if the Boolean value is true and to avalue of zero if the Boolean value is false.

One or more aspects teach a data processor that, in response to aninstance of an instruction specifying a mask operand, a registeroperand, an immediate value operand and another immediate value operand,determines a Boolean value based on the mask operand and sets arespective one of a plurality of registers specified by the registeroperand of the instance to a value of the immediate value operand if theBoolean value is true and to a value of the other immediate valueoperand if the Boolean value is false.

The teachings of one or more aspects provide new machine instructionsthat make programs shorter and faster. More specifically, the newinstructions can be used in cases that previously required severalinstructions. There are code examples where the new instructions reducethe number of registers needed by one. In other cases, the newinstructions eliminate one branch instruction, thus reducing pressure tothe branch prediction logic and eliminating the risk to degradeperformance due to a mispredicted branch. Tests with non-publicimplementations of the new instructions in the Linux compiler gcc onSystem z have demonstrated that (1) the new instructions are easilyintegrated into the code generation of today's compilers, and (2) thatthe new instructions can actually be exploited by the compiler. Anevaluation using some of the SpecCPU 2006 performance test cases andwith the Linux kernel sources suggests that the new instructions provideimprovement in performance.

As touched upon supra, one or more aspects relate to a data processor,e.g. a microprocessor. The data processor may be embodied as anintegrated circuit and may be formed of circuit structures withdimensions on the order of nanometers and/or micrometers. The dataprocessor may comprise input/output circuitry for receiving andoutputting data signals, e.g. data signals representative of binary datato be processed/that has been processed by the data processor.

The data processor may comprise a plurality of registers, e.g. forstoring binary data as known in the art. The plurality of registers maycomprise a plurality of data registers and/or a plurality of generalpurpose registers.

The data processor may comprise instruction execution circuitry. Asknown in the art, the instruction execution circuitry may comprisevarious specialized sub-circuits, e.g. may comprise circuitry fordecoding instructions, circuitry for communicating data to and/or fromone or more or all of the plurality of registers, one or more circuitsfor effecting mathematical computations such as addition, subtraction,multiplication and/or division on binary data and/or circuitry forperforming branch prediction (with respect to one or more sequences ofinstructions). Such branch prediction may be based on one or more(intermediate) results of a data processing carried out by the dataprocessor. The instruction execution circuitry may have a pipelinestructure, e.g. to permit processing to be carried out at a givenminimum frequency. The instruction execution circuitry may becommunicatively connected to one or more or all of the registers. Inother words, the instruction execution circuitry may read and/or writedata to one or more or all of the registers.

The instruction execution circuitry 120 of FIG. 1 may have an associatedinstruction set 200 of FIGS. 2A, and 2B. For example, the instructionexecution circuitry 120 may include hardware that performs dataprocessing solely in response to instructions 201, 202 of FIGS. 1, 2A,and 2B belonging to the instruction set 200. Moreover, the instructionexecution circuitry 120 may be configured to do nothing more thanindicate an error if confronted with an instruction not belonging to theinstruction set 200. Similarly, the instruction execution circuitry 120may be hardwired and/or programmed to perform data operations and/orprocessor control operations (excepting indication of an error) solelyin response to instructions 201, 202 belonging to the instruction set200. In other words, the instruction set 200 may be an inherent featureof the instruction execution circuitry 120. For example, the instructionset 200 may be defined by the hardware and/or firmware of the dataprocessor.

As used herein, the term “instruction” may be understood in twointerrelated senses. In a first sense, the term “instruction” maydesignate a data structure, i.e. a “template” for an instance of aninstruction (in the second sense). In this respect, each instruction201, 202 of the instruction set 200 may specify that data/bits at aparticular location of an instruction (in the second sense) arerepresentative of a data/bit field referred to as an opcode 211 of FIGS.2A and 2B. Each instruction 201 or 202 of the instruction set 200 may beassociated with a respective opcode 211 or 221 that uniquely identifiesthe instruction 201 or 202 and, thus, the data structure. The opcode 211or 221 may inherently specify a data processor operation associated withthe instruction 201 or 202. For example, an instruction may be a 32-bitdata structure, 6 bits of which designate the opcode and 26 bits ofwhich are for various use depending on the value of the opcode, asdepicted in FIG. 2B. For example, in the case of an instruction havingan opcode designating an exclusive OR operation, 8 bits of the datastructure may designate a mask, 4 bits of the data structure maydesignate a first register, 4 bits of the data structure may designate asecond register and 10 bits of the data structure may be unused. Morespecifically, the opcode may represent an instruction to the dataprocessor to place the result of an exclusive OR operation using themask and the contents of the first register as operands into the secondregister. In this respect, one or more or all of the instructions of theinstruction set may comprise data/bits representative of one or moreoperands 213, 224, 225, and 226 of FIGS. 2A and 2B. In a second sense,as touched upon above, the term “instruction” may designate an instanceof a data structure as described above, i.e. data having the givenstructure. As such, an instruction may be binary data, e.g. 32 bits ofdata.

The instruction set 200 may comprise an instruction 201 or 202specifying at least a mask operand 224, a register operand 225 and animmediate value operand 226. In other words, the data processor may beconfigured to perform processing (e.g. as opposed to simply returning anerror) in response to an instruction containing a given opcode, whichopcode signifies to the data processor that particular data/bits of theinstruction are to be interpreted as a mask operand, a register operandand an immediate value operand, respectively.

The instruction execution circuitry, in response to an instance of suchan instruction, may set a respective one of the registers specified bythe register operand to a value of the immediate value operand if theBoolean value is true, i.e. the Boolean value has the value “true”. Forexample, the instruction execution circuitry may set the bits of thespecified register to be identical to the bits of the immediate valueoperand, i.e. to the bits contained in the instruction at a locationknown, by virtue of the data structure associated with the unique opcodecontained in that instruction, to be representative of the immediatevalue operand. The register may be specified by a (binary) valuerepresented by the data/bits in the instruction at a location known, byvirtue of the data structure associated with the unique opcode containedin that instruction, to be representative of the register operand. Forexample, if the bits of the register operand were to be 0 1 1 0 0, thiscould specify register number 12. Similarly, if the bits of the registeroperand were to be 0 0 0 1 1, this could specify register number 3. Afive (5) bit register operand field is shown in FIG. 2B.

Such an instruction may be termed a “load register on conditionimmediate” instruction. Such an instruction might specify no moreoperands than the mask operand, the register operand and the immediatevalue operand.

The instruction execution circuitry, in response to an instance of suchan instruction, may set the respective one of the registers specified bythe register operand to zero if the Boolean value is false, i.e. theBoolean value has the value “false”. In other words, the instructionexecution circuitry may set the register specified by the registeroperand of the instruction to the value of the immediate value operandif the Boolean value is true and to zero if the Boolean value is false.In this case, such an instruction may be termed a “load register oncondition zero or immediate” instruction. Again, such an instructionmight specify no more operands than the mask operand, the registeroperand and the immediate value operand.

Such an instruction may specify another immediate value operand. Inother words, the instruction set may comprise an instruction specifyingat least a mask operand, a register operand, an immediate value operandand another immediate value operand. The instruction executioncircuitry, in response to an instance of such an instruction, may setthe respective one of the registers specified by the register operand toa value of the another immediate value operand if the Boolean value isfalse. In other words, the instruction execution circuitry may set theregister specified by the register operand of the instruction to thevalue of the immediate value operand if the Boolean value is true and tothe value of the another immediate value operand if the Boolean value isfalse. In this case, such an instruction may be termed a “load registeron condition immediate or immediate” instruction. Such an instructionmight specify no more operands than the mask operand, the registeroperand, the immediate value operand and the another immediate valueoperand.

The plurality of registers may comprise at least one status register. Inone or more aspects, the term “status register” may be understood asincluding any meanings associated with the terms “flag register,”“condition code register” and “program status word.” The status registermay store data with regard to a status of the data processor, e.g. aresult status of a previous instruction executed by the instructionexecution circuitry. The status register may receive such data from theinstruction execution circuitry.

The status register may comprise a comparison result flag indicative ofthe result of a (most recent) comparison performed by the instructionexecution circuitry. The comparison result flag may be represented by (asetting of) one or more bits at a given location in the status register.

The status register may comprise a zero flag indicative of whether theresult of a (most recent) operation, e.g. an arithmetic operation, alogical operation or a load operation performed by the instructionexecution circuitry, was zero. The zero flag may be represented by (asetting of) one or more bits at a given location in the status register.

The status register may comprise a carry flag. The carry flag may beindicative of whether the result of a (most recent) addition operationperformed by the instruction execution circuitry yielded a carry.Similarly, the carry flag may be indicative of whether the result of a(most recent) subtraction operation performed by the instructionexecution circuitry required a carry/borrow. Likewise, the carry flagmay be indicative of whether the result of a (most recent) shift/rotateoperation performed by the instruction execution circuitry resulted in abit being “pushed out.” The carry flag may be represented by (a settingof) one or more bits at a given location in the status register.

The status register may comprise a sign flag and/or a negative flagindicative of whether the result of a (most recent) arithmetic operationwas negative. Each of the sign flag and/or the negative flag may berepresented by (a setting of) one or more bits at a given location inthe status register.

The status register may comprise an overflow flag indicative of whetherthe signed result of a (most recent) arithmetic operation performed bythe instruction execution circuitry was too large to fit in the registerwidth using twos complement representation. The overflow flag may berepresented by (a setting of) one or more bits at a given location inthe status register.

The status register may comprise a parity flag indicative of whether thenumber of set bits of a result of a (most recent) arithmetic operationperformed by the instruction execution circuitry is odd or even. Theparity flag may be represented by (a setting of) one or more bits at agiven location in the status register.

In cases where the instruction execution circuitry comprises a pluralityof execution cores, each execution core may comprise its own respectivestatus register. In this case, the flags/data in a respective statusregister may be indicative of respective results of a (most recent)operation in the respective execution core. Similarly, one or more orall of the execution cores may share a status register. In this case,the flags/data in a respective status register may be indicative ofrespective results of a (most recent) operation within the executioncores that share the status register.

As touched upon above, the data processor may moreover comprise aplurality of status registers. For example, the data processor maycomprise multiple concurrent status registers that contain results ofmultiple instructions, e.g. of a corresponding multiplicity ofinstructions.

The instruction execution circuitry may interpret the register operandas specifying a data register of the plurality of registers. Similarly,the instruction execution circuitry may interpret the register operandas specifying a general purpose register of the plurality of registers.In other words, the register operand may be limited to specifying a dataregister and/or a general purpose register, i.e. might be prohibitedfrom specifying e.g. a status register and/or an address register of thedata processor.

The aforementioned determining of a Boolean value based on a maskoperand may comprise setting the Boolean value to a value in the statusregister specified by the mask operand, e.g. to the value of a bit inthe status register specified by the mask operand. For example, the maskoperand may be a 3-bit operand, the first bit designating the carryflag, the second bit designating the comparison result flag and thethird bit designating the zero flag. If the mask operand has the value 10 0 and the carry flag is set to 1, the Boolean value may be set to thevalue of the carry flag, namely to 1. A three (3) bit mask operand fieldis shown in FIG. 2B.

Similarly, the aforementioned determining of a Boolean value based on amask operand may comprise determining whether one or more values storedin the status register are equal to corresponding values in the maskoperand. Inter alia, the determining may comprise setting the Booleanvalue to a value indicative of whether one or more values stored in thestatus register are equal to corresponding values in the mask operand.For example, the mask operand may again be a 3-bit operand, the firstbit designating the carry flag, the second bit designating the overflowflag and the third bit designating the zero flag. If the mask operandhas the value 1 0 0 and the carry flag, the overflow flag and the zeroflag are respectively set to 1, 0 and 0, then the Boolean value may beset to a value representative of true. Similarly, if the mask operandhas the value 1 0 0 and the carry flag, the overflow flag and the zeroflag are respectively set to 0, 0 and 1, then the Boolean value may beset to a value representative of false.

As used herein, references to the data processor/instruction executioncircuitry “responding” to an instruction may be understood in the sensethat the instruction (in the sense of several bits of data) is loadedinto an execution register of the data processor/instruction executioncircuitry and/or reaches the “front” of an instruction queue of the dataprocessor/instruction execution circuitry and that the dataprocessor/instruction execution circuitry takes action as a result ofthat instruction. It will be understood that, in cases where theinstruction execution circuitry comprises a plurality of executioncores, each execution core may comprise its own respective instructionqueue. Similarly, one or more or all of the execution cores may share aninstruction core. Similarly, references to the dataprocessor/instruction execution circuitry “responding” to an instructionmay be understood in the sense that the data processor/instructionexecution circuitry begins processing of the instruction or begins dataprocessing in response to a decoding of the instruction. As touched uponabove, execution of an instruction need not be effected in a single stepor within a single clock cycle. Instead, execution of an instruction maycomprise a plurality of (pipelined) micro-operations. Similarly,processing of an instruction may comprise one or more preparatoryactions such as prefetching the instruction from an instruction queue,decoding of the instruction, etc.

While one or more aspects have been discussed hereinabove mainly in theform of a system, one or more aspects may be embodied, mutatis mutandis,in the form of a method, e.g. a method for processing data in a dataprocessor, as will be appreciated by the person skilled in the art. Sucha method may comprise any of the actions disclosed hereinabove, whichactions need not be tied to a particular apparatus or element.

FIG. 1 schematically shows an embodiment of a data processor 100 inaccordance with one or more aspects, e.g. as described above.

In the illustrated embodiment, data processor 100 comprises a pluralityof registers 110-118 and instruction execution circuitry 120. Theplurality of registers includes a status register 118. Although dataprocessor 100 is shown as comprising nine registers, a data processor inaccordance with one or more aspects may comprise any number ofregisters.

In the following, the advantages and operation of data processor 100will be discussed in greater detail.

As touched upon above, the status register (containing a so-calledCondition Code (CC)) within a processor may contain the result status ofa previous machine instruction. For example, loading a value from memoryinto a register may have the effect to let CC indicate some basicproperties of said value like “is negative” or “equals zero”. Inparticular, the CC may also contain the result of comparison operations.Depending on the instruction set architecture, there may be multipleconcurrent CCs that contain results of multiple instructions.

A frequently found code pattern in machine programs is subsequent codedepending on the value of CC. Such a code pattern may be a branchinstruction that, depending on CC, will or will not redirect the flow ofcontrol. In many situations, such dependent code loads a register withsome values with the intention of using the CC content as an integer orBoolean value. Typical examples include:

-   -   1. Functions returning the result of a comparison,    -   2. Storing the result of a comparison in a Boolean or integer        variable (used as “flag”),    -   3. Splitting complex Boolean expressions into more readable code        by storing intermediate results into variables.

Programming languages such as C support this. The C language standard,for example, comprises that the result of a comparison be represented asinteger 0 or 1, respectively. Other common representations may use −1,i.e. the bit pattern 1 1 1 . . . 1 1 1.

Conventional instruction sets use several instructions for either case.In the following, a few code examples will be discussed wherein themachine code was generated using the Linux compiler gcc on System z withcode optimization turned on.

Example 1: “Comparing Integer Numbers Using Exclusive OR”

The following C code:

int testseven (int fff, int qqq) {  int res;  res= (fff == qqq);  printf(“res= %d \n”, res);  return res; }stores the result of a comparison between two integer variables intoanother integer variable. The result is “1” in case the numbers areequal and “0” otherwise. This source code translates into the followingmachine code:

testseven: stmg %r12,%r15,96(%r15) lr %r12,%r2 xr %r12,%r3 lpr %r12,%r12lay %r15,−160(%r15) ahi %r12,−1 larl %r2,.LC0 srl %r12,31 lgfr %r12,%r12lgr %r3,%r12 brasl %r14,printf lgr %r2,%r12 lg %r4,272(%r15) lmg%r12,%r15,256(%r15) br %r4

All machine instructions involved are marked by underlining. The “xr”instruction creates a bitwise exclusive or of the variables “fff” and“qqq,” i.e. if the operands are equal, the result will have all bitsequal to zero, and if the operands are not equal, the result will haveat least one bit not equal to zero. The following “lpr” instructiontreats the result as a signed value and transforms the result to itsabsolute, unsigned value. The transformed result is in the range of0x00000000 to 0x80000000. To produce the final result, the “ahi”instruction is used to subtract one from the result, transforming 0 to0xFFFFFFFF and all other numbers to a value in the range of 0x00000000to 0x7FFFFFFF. Finally, the result is shifted to the right by 31 bits bythe “srl” instruction in order to return 1 in case the operands areequal and 0 for all other cases.

Example 2: “Float Compare with Branch”

The following C code:

int test6 (double fff, double ggg) {  int res;  res= (fff == ggg); printf (“res= %d \n”, res);  return 0; }compares two floating point numbers and stores the result into aninteger variable. The compiler generates the following machine code:

test6: stmg %r14,%r15,112(%r15) aghi %r15,−160 lhi %r3,1 larl %r2,.LC0cdbr %f0,%f2 je .L2 lhi %r3,0 .L2: lgfr %r3,%r3 brasl %r14,printf lghi%r2,0 lmg %r14,%r15,272(%r15) br %r14

Again, any instructions involved in handling the comparison are markedby underlining. The integer value is finally found in register r3 thatgets initialized with value 1 by the “lhi” instruction. The comparisonis performed by the “cdbr” instruction. Depending on the result, asubsequent branch instruction “je” causes the processor to skip or notto skip the instruction that overwrites the content of r3 with 0 (“lhi %r3,0”).

Example 3: “Float Compare Using INSERT PROGRAM MASK (IPM)”

The next example checks the sign of a floating point value and storesthe result into an integer variable:

int testfff (double fff) {  int res;  res= signbit (fff);  printf (“res=%d \n”, res);  return res; }

For this code, the compiler exploits test instruction “tcdb”, puts theresulting condition code into a register using instruction “ipm” andfinally shifts the inserted bit into the right position:

testfff: stmg %r13,%r15,104(%r15) larl %r2,.LC0 lay %r15,−160(%r15) tcdb%f0,1365 ipm %r13 srl %r13,28 lgfr %r13,%r13 lgr %r3,%r13 brasl%r14,printf lgr %r2,%r13 lmg %r13,%r15,264(%r15) br %r14

Here this only works for condition code values with exactly one bit set.

Example 4: Using LOAD ON CONDITION

An embodiment of the System z instruction set includes a LOAD ONCONDITION (LOCR) instruction. Its third operand is a value selectingwhat CC value to check. The first and second operands are numbersdenoting two general purpose registers, r1 and r2. Depending on the CCvalue, the contents of r1 gets or does not get overwritten by thecontent of r2. A code example may look like this:

LHI 3,0 Load value 0 into GR3

LHI 7,1 Load value 1 into GR7

LOCR 3,7,8 Moves content of GR7 to GR3 if CC=0

As is apparent from the above example, this instruction has thedisadvantage of requiring an additional register.

One or more aspects teach a family of load register on conditioninstructions. This family of instruction includes a LOAD REGISTER ONCONDITION WITH ZERO OR IMMEDIATE (LROCZI) instruction, a LOAD REGISTERON CONDITION IMMEDIATE instruction, i.e. without zero as default value,and a LOAD REGISTER ON CONDITION IMMEDIATE OR OTHER IMMEDIATEinstruction, i.e. with a default value that may differ from zero.

The LOAD REGISTER ON CONDITION WITH ZERO OR IMMEDIATE (LROCZI)instruction has, for instance, the form:

LROCZI mask, reg, immediate_value

where mask, also referred to as mask operand, may be a value selectingwhich CC value to test, reg, also referred to as register operand, maybe a number denoting a general purpose register, and immediate_value,also referred to as immediate value operand, may be some integer value.

LROCZI has the semantics to load immediate_value into reg if CC has thevalue specified in mask; otherwise, value 0 is put into reg. Advantagesof this instruction include, for instance:

-   -   Essentially all language implementations employ 0 as one of the        bit patterns for representing logical values, because testing        for 0 has always been simple and cheap. Being flexible with        respect to the second value should make the instruction fit        everywhere.    -   Compared to the first three examples above, LROCZI can save        several instructions and several cycles execution time.    -   Compared to using LOAD ON CONDITION (see example 4 above),        LROCZI can not only replace three instructions, but can also        save one register.

To summarize, this instruction offers several possibilities forperformance improvements:

-   -   Code gets faster by saving cycles. Using LROCZI replaces several        other instructions.    -   LROCZI can reduce the number of required registers. This has a        positive effect on performance in cases where temporary results        otherwise had to be stored in memory. An additional free        register can also enable additional compiler optimization (in        particular, common sub-expression elimination may avoid        duplicate calculations but uses one register for keeping the        intermediate result).    -   Code gets shorter. This may cause instruction sequences to fit        completely into one cache line. Shorter code may allow the        compiler to perform more aggressive loop unrolling.    -   In some cases, LROCZI replaces branch instructions. This avoids        the risk of a performance penalty due to a mispredicted branch.

The following examples exemplify how frequently and in what cases acompiler can make use of the LROCZI instruction.

Resulting Code for previous examples using LROCZI

Example 1

Code using LROCZI Code without LROCZI testseven: testseven: stmg%r12,%r15,96(%r15) stmg %r12,%r15,96(%r15) lr %r12,%r2 lr %r12,%r2 xr%r12,%r3 xr %r12,%r3 lroczi 8,%r12,1 lpr %r12,%r12 lay %r15,−160(%r15)lay %r15,−160(%r15) ahi %r12,−1 larl %r2,.LC0 larl %r2,.LC0 srl %r12,31lgfr %r12,%r12 lgfr %r12,%r12 lgr %r3,%r12 lgr %r3,%r12 brasl%r14,printf brasl %r14,printf lgr %r2,%r12 lgr %r2,%r12 lg r4,272(%r15)lg r4,272(%r15) lmg %r12,%r15,256(%r15) lmg %r12,%r15,256(%r15) br %r4br %r4

The code sequence using LROCZI is two instructions shorter than the codewithout LROCZI.

Example 2 is Depicted as E202 of FIG. 2C

Code using LROCZI Code without LROCZI test6: test6: stmg%r14,%r15,112(%r15) stmg %r14,%r15,112(%r15) aghi %r15,−160 aghi%r15,−160 lhi %r3,1 larl %r2,.LC0 larl %r2,.LC0 cdbr %f0,%f2 cdbr%f0,%f2 lroczi 8,%r3,1 je .L2 lhi %r3,0 .L2: lgfr %r3,%r3 lgfr %r3,%r3brasl %r14,printf brasl %r14,printf lghi %r2,0 lghi %r2,0 lmg%r14,%r15,272(%r15) lmg %r14,%r15,272(%r15) br %r14 br %r14

The code sequence using LROCZI is two instructions shorter and avoids aconditional branch.

Example 3

Code using LROCZI Code without LROCZI testfff: testfff: stmg%r13,%r15,104(%r15) stmg %r13,%r15,104(%r15) larl %r2,.LC0 larl %r2,.LC0lay %r15,−160(%r15) lay %r15,−160(%r15) tcdb %f0,1365 tcdb %f0,1365lroczi 4,%r13,1 ipm %r13 srl %r13,28 lgfr %r13,%r13 lgfr %r13,%r13 lgr%r3,%r13 lgr %r3,%r13 brasl %r14,printf brasl %r14,printf lgr %r2,%r13lgr %r2,%r13 lmg %r13,%r15,264(%r15) lmg %r13,%r15,264(%r15) br %r14 br%r14

The code sequence using LROCZI is one instruction shorter.

Example 4 is Depicted as E202 of FIG. 2C

Code using LROCZI Code without LROCZI lroczi 8, 3, 1 Load value 0 or 1lhi 3,0 Load value 0 into GR3 into GR3 if CC=0 lhi 7,1 Load value 1 intoGR7 locr 3,7,8 Moves content of GR7 to GR3 if CC=0

The code sequence using LROCZI uses two less instructions and one lessregister.

Frequency and Context of LROCZI Usage

To get an impression of how LROCZI behaves in practice, the instructionwas implemented within the Linux compiler gcc on System z. As expected,the prototype compiler generates the expected assembler code for thefirst three code examples shown above.

Occurrence in the Linux Kernel:

As a large piece of code relevant to customers, a Linux kernel wascompiled using the prototype compiler. The Linux kernel version used was2.6.16.60-0.42.5, which is the basis for the Linux distribution “SuseLinux Enterprise Server SLES10”. The kernel was configured to contain asmuch code as possible. The loadable binary image had a size of 128 MB.

The binary contained a total of 3494 LROCZIs. This indicates asignificant improvement. The Linux kernel has lots of functionsreturning values in a way such that LROCZI will make this code fasterand shorter.

3328 of these LROCZIs are used as a replacement for code patterns thatwere previously implemented using jumps or doing arithmetic tricks.Another 166 LROCZIs are used to replace IPMs.

Occurrence in SPEC2006 Test Case 401.BZIP2:

The prototype compiler was applied to test case 401.BZIP2 of theSPEC2006 test suite. This test case is used to make official statementsof performance of a computer system and thus relevant for this kind ofevaluation.

Test case bzip2 has the following hot functions:

name of function found in file number of LROCZIs mainSort blocksort.s 17BZ2_decompress decompress.s 2 fallbackSort blocksort.s 10 mailGtUblocksort.s 2

As demonstrated by the above table, test case 401.BZIP2 employs asignificant number of code situations where LROCZIs can be used toimprove efficiency. Accordingly, performance improvements may beexpected.

As will be appreciated by one skilled in the art, aspects of the presentdisclosure may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present disclosure may take theform of an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present disclosure may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects may bewritten in any combination of one or more programming languages,including an object oriented programming language such as Java,Smalltalk, C++ or the like and conventional procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The program code may execute entirely on the user's computer,partly on the user's computer, as a stand-alone software package, partlyon the user's computer and partly on a remote computer or entirely onthe remote computer or server. In the latter scenario, the remotecomputer may be connected to the user's computer through any type ofnetwork, including a local area network (LAN) or a wide area network(WAN), or the connection may be made to an external computer (forexample, through the Internet using an Internet Service Provider).

Aspects of the present disclosure are described with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of thepresent disclosure. It will be understood that each block of theflowchart illustrations and/or block diagrams, and combinations ofblocks in the flowchart illustrations and/or block diagrams, can beimplemented by computer program instructions. These computer programinstructions may be provided to a processor of a general purposecomputer, special purpose computer, or other programmable dataprocessing apparatus to produce a machine, such that the instructions,which execute via the processor of the computer or other programmabledata processing apparatus, create means for implementing thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The block diagrams in the Figures illustrate the architecture,functionality, and operation of possible implementations of systems,methods and computer program products according to various embodimentsof the present disclosure. In this regard, each block in the blockdiagrams may represent a module, segment, or portion of code, whichcomprises one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions discussed hereinabove mayoccur out of the disclosed order. For example, two functions taught insuccession may, in fact, be executed substantially concurrently, or thefunctions may sometimes be executed in the reverse order, depending uponthe functionality involved. It will also be noted that each block of theblock diagrams, and combinations of blocks in the block diagrams, can beimplemented by special purpose hardware-based systems that perform thespecified functions or acts, or combinations of special purpose hardwareand computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the one or moreaspects. As used herein, the singular forms “a”, “an” and “the” areintended to include the plural forms as well, unless the context clearlyindicates otherwise. It will be further understood that the terms“comprises” and/or “comprising,” when used in this specification,specify the presence of stated features, integers, steps, operations,elements, and/or components, but do not preclude the presence oraddition of one or more other features, integers, steps, operations,elements, components, and/or groups thereof. In one or more aspects, theverb “may” is used to designate optionality/noncompulsoriness. In otherwords, something that “may” can, but need not.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of one or more aspects has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the one or more aspects in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the one ormore aspects. The embodiment was chosen and described in order to bestexplain the principles of the one or more aspects and the practicalapplication, and to enable others of ordinary skill in the art tounderstand the one or more aspects for various embodiments with variousmodifications as are suited to the particular use contemplated.

What is claimed is:
 1. A computer system for facilitating processing ina computing environment, the computer system comprising: a memory; and aprocessor in communication with the memory, wherein the computer systemis configured to perform a method, said method comprising: executing aninstruction of an instruction set, the instruction having access to amask operand and an immediate value operand, and wherein the executingincludes: determining whether a condition code is set to a valueindicated in said mask operand; and setting a location, specified usingsaid instruction, to a value of said immediate value operand, based onsaid condition code being set to the value indicated in said maskoperand.
 2. The computer system of claim 1, wherein the locationcomprises a register.
 3. The computer system of claim 2, wherein theregister is specified in a register operand of the instruction.
 4. Thecomputer system of claim 3, wherein said instruction is a load registeron condition immediate instruction and specifies no more operands thansaid mask operand, said register operand and said immediate valueoperand.
 5. The computer system of claim 1, wherein said instructionfurther specifies an another immediate value operand, and wherein saidmethod further comprises setting a selected location to a value of saidother immediate value operand based on said condition code not being setto the value.
 6. The computer system of claim 5, wherein the selectedlocation is a register.
 7. The computer system of claim 6, wherein theregister is specified in a register operand of the instruction.
 8. Thecomputer system of claim 7, wherein said instruction is a load registeron condition immediate or immediate instruction and specifies no moreoperands than said mask operand, said register operand, said immediatevalue operand and said other immediate value operand.
 9. The computersystem of claim 1, wherein a Boolean value is set based on whether thecondition code is set to the value in said mask operand, said Booleanvalue to be used to set the location based on the Boolean value.
 10. Acomputer program product for facilitating processing in a computingenvironment, the computer program product comprising: a non-transitorycomputer readable storage medium readable by a processing circuit andstoring instructions for performing a method comprising: executing aninstruction of an instruction set, the instruction having access to amask operand and an immediate value operand, and wherein the executingincludes: determining whether a condition code is set to a valueindicated in said mask operand; and setting a location, specified usingsaid instruction, to a value of said immediate value operand, based onsaid condition code being set to the value indicated in said maskoperand.
 11. The computer program product of claim 10, wherein thelocation comprises a register, and wherein the register is specified ina register operand of the instruction.
 12. The computer program productof claim 11, wherein said instruction is a load register on conditionimmediate instruction and specifies no more operands than said maskoperand, said register operand and said immediate value operand.
 13. Thecomputer program product of claim 10, wherein said instruction furtherspecifies an another immediate value operand, and wherein said methodfurther comprises setting a selected location to a value of said otherimmediate value operand based on said condition code not being set tothe value.
 14. The computer program product of claim 13, wherein theselected location is a register, and wherein the register is specifiedin a register operand of the instruction.
 15. The computer programproduct of claim 14, wherein said instruction is a load register oncondition immediate or immediate instruction and specifies no moreoperands than said mask operand, said register operand, said immediatevalue operand and said other immediate value operand.
 16. Acomputer-implemented method of facilitating processing in a computingenvironment, the computer-implemented method comprising: executing aninstruction of an instruction set, the instruction having access to amask operand and an immediate value operand, and wherein the executingincludes: determining whether a condition code is set to a valueindicated in said mask operand; and setting a location, specified usingsaid instruction, to a value of said immediate value operand, based onsaid condition code being set to the value indicated in said maskoperand.
 17. The computer-implemented method of claim 16, wherein thelocation comprises a register, and wherein the register is specified ina register operand of the instruction.
 18. The computer-implementedmethod of claim 17, wherein said instruction is a load register oncondition immediate instruction and specifies no more operands than saidmask operand, said register operand and said immediate value operand.19. The computer-implemented method of claim 16, wherein saidinstruction further specifies an another immediate value operand, andfurther comprising setting a selected location to a value of said otherimmediate value operand based on said condition code not being set tothe value.
 20. The computer-implemented method of claim 19, wherein theselected location is a register, and wherein the register is specifiedin a register operand of the instruction.